home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / progjrn / pj_7_2.arc / PWCOMM2.ARC / AUXPRT.H next >
Text File  |  1988-12-10  |  1KB  |  54 lines

  1. /* 
  2.  * Include file for Winaux/PMaux.
  3.  * See WPMAUX.DOC for usage
  4.  *
  5.  * Written by William S. Hall
  6.  *
  7.  */
  8.  
  9. char auxbuf[80];
  10. void auxprt(char *str)
  11. {
  12.  
  13.     HWND hWnd;
  14.     int len = strlen(str);
  15.  
  16. /* use this section for windows */
  17. #if defined(WINAUX)
  18.   /* get the handle for winaux from win.ini */
  19.     hWnd = (HWND)GetProfileInt((LPSTR)"Winaux", (LPSTR)"hWnd", 0);
  20.   /* send over the buffer */
  21.     if (IsWindow(hWnd))
  22.     SendMessage(hWnd, WM_USER, (WORD)len, (LONG)(LPSTR)str);
  23. #endif
  24.  
  25. /* use this section for Presentation Manager */
  26. #if defined(PMAUX)
  27.     char hbuf[40];
  28.     SEL sel;
  29.     PCH pchBuf;
  30.     int i;
  31.  
  32.   /* get the string representation of the handle for pmaux from OS2.INI */
  33.     WinQueryProfileString(hAB, "PMaux", "hWnd", "", hbuf, 40);
  34.   /* convert to a handle */
  35.     hWnd = (HWND)atol(hbuf);
  36.     if (WinIsWindow(hAB, hWnd)) {
  37.       /* create a shared buffer which can be read by another process */
  38.         if (DosAllocSeg(len, &sel, SEG_GETTABLE) == 0) {
  39.           /* make a long pointer to the buffer */
  40.         pchBuf = MAKEP(sel,0);
  41.           /* load it up */
  42.            for (i = 0; i < len; i++)
  43.             *(pchBuf+i) = *(str+i);
  44.           /* send it over */
  45.         WinSendMsg(hWnd, WM_USER, (MPARAM)len, (MPARAM)sel);
  46.           /* free the buffer */
  47.         DosFreeSeg(sel);
  48.         }
  49.         else  /* error, ring the bell */
  50.         WinAlarm(HWND_DESKTOP, WA_WARNING);    
  51.     }
  52. #endif
  53. }
  54.